<?php

namespace app\admin\model\river;

use think\Model;

class Product extends Model
{
    // 表名
    protected $name = 'river_product';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'salestatus_text'
    ];
    

    
    public function getSalestatusList()
    {
        return ['可銷售' => __('可銷售'),'不可銷售' => __('不可銷售'),'已售完' => __('已售完'),'' => __('')];
    }     


    public function getSalestatusTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['salestatus']) ? $data['salestatus'] : '');
        $list = $this->getSalestatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
